import Vue from 'vue'
import Router from 'vue-router'

import index from '@/pages/index'
import login from '@/pages/login'
import signUpInfo from '@/pages/signUpInfo'
import order from '@/pages/order'
import activity from '@/pages/activity'
import station from '@/pages/station'
import cardIndex from '@/pages/cardIndex'
import articalList from '@/pages/articalList'
import artical from '@/pages/artical'
import shareIndex from '@/pages/shareIndex'
import author from '@/pages/author'
import download from '@/pages/download'

import disIndex from '@/pages/disIndex'


import my_share_month from '@/pages/my_share_month'
import my_share_team from '@/pages/my_share_team'
import income from '@/pages/income'
import my_share_huiyuanma from '@/pages/my_share_huiyuanma'
import fuwushangma from '@/pages/fuwushangma'
import my_share_tuijianren from '@/pages/my_share_tuijianren'
import my_share_income from '@/pages/my_share_income'
import my_share_monthly_earnings from '@/pages/my_share_monthly_earnings'

import received from '@/pages/received'
import strategy from '@/pages/strategy'
import howToChat from '@/pages/howToChat'
import joinAndCreation from '@/pages/joinAndCreation'
import advertising from '@/pages/advertising'
import participateInActivities from '@/pages/participateInActivities'
import howToInteraction from '@/pages/howToInteraction'
import inspecTticket from '@/pages/inspecTticket'
import showCode from '@/pages/showCode'
import paymentPassword from '@/pages/paymentPassword'
import loginPassword from '@/pages/loginPassword'
import personalData from '@/pages/personalData'
Vue.use(Router)
export default new Router({
  mode: 'history',
  // base: '/wuwushop/',
  // mode: 'hash',
  routes: [
    //首页
    {
      // path:'/index',
      path: '/',
      name: 'index',
      component: index,
    },
    //login
    {
      path: '/login',
      name: 'login',
      component: login,
     
    },
     //报名信息
     {
      path: '/signUpInfo',
      name: 'signUpInfo',
      component: signUpInfo,
    },
     //下单
     {
      path: '/order',
      name: 'order',
      component: order,
    },
     //下单
     {
      path: '/activity',
      name: 'activity',
      component: activity,
    },
     //下单
     {
      path: '/station',
      name: 'station',
      component: station,
    },
     //名片首页
     {
      path: '/cardIndex', 
      name: 'cardIndex',
      component: cardIndex,
    },
     //文章列表
     {
      path: '/articalList',
      name: 'articalList',
      component: articalList,
    },
     //文章
     {
      path: '/artical',
      name: 'artical',
      component: artical,
    },
     //分享页
     {
      path: '/shareIndex',
      name: 'shareIndex',
      component: shareIndex,
    },
    //微信授权中间页
    {
      path: '/author',
      name: 'author',
      component: author,
    },
    //下载页面
    {
      path: '/download',
      name: 'download',
      component: download,
    },
    
    {
      //每月收益明细
      path: '/my_share_monthly_earnings',
      name: 'my_share_monthly_earnings',
      component: my_share_monthly_earnings,
      meta: {
        isShow: true
      }
    },
    // 我的分享-收益明细
    {
      // path:'/my_share_month',
      path:'/my_share_income',
      name:'my_share_income',
      component:my_share_income,
      meta: {
        isShow: true
      }
    },
    // 我的分享-我的推荐人
    {
      path:'/my_share_tuijianren',
      // path:'/',
      name:'my_share_tuijianren',
      component:my_share_tuijianren,
      meta: {
        isShow: true
      }
    },
    // 我的分享-服务商码
    {
      path:'/fuwushangma',
      // path:'/',
      name:'fuwushangma',
      component:fuwushangma,
      meta: {
        isShow: true
      }
    },
    // 我的分享-会员码
    {
      path:'/my_share_huiyuanma',
      // path:'/',
      name:'my_share_huiyuanma',
      component:my_share_huiyuanma,
      meta: {
        isShow: true
      }
    },
    // 我的分享-收益明细（上划效果）
    {
      path:'/income',
      // path:'/',
      name:'income',
      component:income,
      meta: {
        isShow: true
      }
    },
    // 我的分享-我的团队
    {
      path:'/my_share_team',
      // path:'/',
      name:'my_share_team',
      component:my_share_team,
      meta: {
        isShow: true
      }
    },
    // 我的分享-每月收益明细
    {
      path:'/my_share_month',
      // path:'/',
      name:'my_share_month',
      component:my_share_month,
      meta: {
        isShow: true
      }
    },
    //首页
    {
      path: '/disIndex',
      name: 'disIndex',
      component: disIndex,
      meta: {
        isShow: true
      }
    },
    //收到分享
    {
      path: '/received',
      name: 'received',
      component: received,
      meta: {
        isShow: true
      }
    },
    //新手使用攻略
    {
      // path:'/',
      path: '/strategy',
      name: 'strategy',
      component: strategy,
      meta: {
        isShow: true
      }
    },
    // 如何与好友聊天
    {
      path: '/howToChat',
      name: 'howToChat',
      component: howToChat,
      meta: {
        isShow: true
      }
    },
    //加入和创建群聊
    {
      path: '/joinAndCreation',
      name: 'joinAndCreation',
      component: joinAndCreation,
      meta: {
        isShow: true
      }
    },
    //企业如何做广告宣传与引流？
    {
      path: '/advertising',
      name: 'advertising',
      component: advertising,
      meta: {
        isShow: true
      }
    },
    //如何参加活动
    {
      path: '/participateInActivities',
      name: 'participateInActivities',
      component: participateInActivities,
      meta: {
        isShow: true
      }
    },
    //如何互动
    {
      path: '/howToInteraction',
      name: 'howToInteraction',
      component: howToInteraction,
      meta: {
        isShow: true
      }
    },
     //如何验票
     {
      path: '/inspecTticket',
      name: 'inspecTticket',
      component: inspecTticket,
      meta: {
        isShow: true
      }
    },
     //如何出示二维码
     {
      path: '/showCode',
      name: 'showCode',
      component: showCode,
      meta: {
        isShow: true
      }
    },
    //如何设置支付密码
    {
      path: '/paymentPassword',
      name: 'paymentPassword',
      component: paymentPassword,
      meta: {
        isShow: true
      }
    },
     //如何设置登录密码
     {
      path: '/loginPassword',
      name: 'loginPassword',
      component: loginPassword,
      meta: {
        isShow: true
      }
    },
    //如何设置个人资料
    {
      path: '/personalData',
      name: 'personalData',
      component: personalData,
      meta: {
        isShow: true
      }
    },
  ],
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
    if (to.hash) {
      return {
        selector: to.hash
      }
    }
  },

  beforeRouteEnter(to, from, next) {
    // 这个地方的代码是在create之前调用
    next(vm => {
      if (to.meta.isShow > from.meta.index) { } else if (to.meta.index < from.meta.index) { } else { }
    })

  },
})





